using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.Graphics;
using Android.OS;
using Android.Preferences;
using Android.Runtime;
using Android.Telephony;
using Android.Util;
using Android.Views;
using Android.Widget;

namespace NorthStar.Passenger
{
    public class Helper
    {

        public static string GetServer(Context context)
        {
            ISharedPreferences _preferences = PreferenceManager.GetDefaultSharedPreferences(context);

            return _preferences.GetString("server", "http://192.168.1.1/TheNorthStar");
        }
        public static string GetDeviceId(Context context)
        {
            ISharedPreferences _preferences = PreferenceManager.GetDefaultSharedPreferences(context);

           
            string imei = _preferences.GetString("imei", "ABC12345");
            return imei;
            /*TelephonyManager telephonyMgr = context.GetSystemService(Context.TelephonyService) as TelephonyManager;

            string deviceId = telephonyMgr.DeviceId == null ? imei : telephonyMgr.DeviceId;

            return deviceId;*/
        
        }



        /// <summary>
        /// Retrieve the PhoneNumber from the TelephonyManager
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static string GetPhoneNumber(Context context)
        {
            ISharedPreferences _preferences = PreferenceManager.GetDefaultSharedPreferences(context);

            string phoneNumberTemp = _preferences.GetString("phoneNumber", "04112345678");
            return phoneNumberTemp;
            /*TelephonyManager telephonyMgr = context.GetSystemService(Context.TelephonyService) as TelephonyManager;
            string phoneNumber = telephonyMgr.Line1Number == null ? phoneNumberTemp : telephonyMgr.Line1Number;

            return phoneNumber;*/

        }
    }
}